home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-04-05 | 3.7 KB | 65 lines | [TEXT/MMCC] |
- //------------------------------------------------------------------------------
- // File: view.h
- // Date: 9/18/94
- // Author: Bretton Wade
- //
- // Description: this file contains the class definition for a view of space
- //
- //------------------------------------------------------------------------------
-
- #include "gworld.h"
- #include "interface.h"
- #include "matrix_3d.h"
- #include "point_2d.h"
- #include "polyptr_3d.h"
- #include "camera_3d.h"
-
- #ifndef VIEW
- #define VIEW
-
- //------------------------------------------------------------------------------
- // classes
- //------------------------------------------------------------------------------
- class view : public gworld // view class
- { // begin view definition
- private: // private interface
- point_2d dctovdc (const Point &p) const; // map screen coordinates to virtual device coordinates
- Point vdctodc (const point_2d &p) const; // map virtual device coordinates to screen coordinates
- protected: // protected interface
- camera cam; // camera_3d
- bool cull; // flag to control backface culling
- interface *gui; // pointer to the interface controller
- matrix_3d sum, // the sum of the interface transformations
- transformation, // the transformation for points
- inverse, // the inverse of the current transformation matrix_3d
- viewing; // the final viewing transformation
- real xsize, ysize, aspect; // parameters for mapping
- point_3d eye; // eye point_3d
- public: // public interface
- static view *current; // static value for the current view
- view (window *w); // constructor
- virtual ~view (void); // destructor
- void AddInterface (interface *i); // add an interface to the view
- void MoveToPt (const point_2d &pt) const; // move to a point_2d
- void LineToPt (const point_2d &pt) const; // draw a line to a point_2d
- void Circle (const point_2d &a, const point_2d &b) const; // draw a circle defined by the rectangle 'ab'
- void CrossHair (const point_2d &p) const; // draw a crosshair at the specified location
- void DrawPolygon (polyptr poly); // draw a polygon (transformed by the camera_3d)
- void DrawScene (void); // draw the scene that this view is for
- virtual void HandleClick (EventRecord &event); // handle mouse down/up
- virtual void Resize (EventRecord &event); // recompute sizing information from parent
- virtual void StartDrawing (gw_erase e = ERASE); // lock down the gworld and set the port appropriately
- virtual void StopDrawing (gw_update u = UPDATE); // unlock the gworld and reset the port
- }; // end view class definition
-
- //------------------------------------------------------------------------------
- // inlines
- //------------------------------------------------------------------------------
- inline void view::AddInterface (interface *i) // add an interface to the view
- { // begin
- gui = i; // store the interface
- } // end
-
- //------------------------------------------------------------------------------
-
- #endif //VIEW